<?php

namespace IDock\Insurance\ZYIC\Request;

use IDock\Insurance\ZYIC\ZYICEnums;
use IDock\Insurance\ZYIC\Request\AllZYICRequest;
use IDock\Insurance\ZYIC\Response\SaveOrderResponse;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\VehicleActualValueVisitor;

class SaveOrderRequest extends AllZYICRequest
{
    public $route = 'channelInterface/V05';

    protected $response = SaveOrderResponse::class;

    protected $urlTip = '投保单保存';

    /*** @var  PremiumInquiryVisitor $visitor */
    protected $visitor;

    public function generate(): array
    {
        $arr = [
            'proposalNo' => $this->visitor->getUnderwritingVisitor()->biInquiryNo ?: $this->visitor->getUnderwritingVisitor()->ciInquiryNo,
            'proposalNoCI' => $this->visitor->getUnderwritingVisitor()->ciInquiryNo,
            'insuranceNonCar' => 0
        ];
        if(!empty($this->visitor->getNonCarInquiryVisitor()->getNonCarList())){
            $arr['insuranceNonCar'] = 1;
        }
        return $arr;
    }

}
